#ifndef WIDGET_DOCTOR_H
#define WIDGET_DOCTOR_H

#include <QWidget>
#include <QPainter>
#include <QtCharts/QChartView>
#include <QtCharts/QBarSeries>
#include <QtCharts/QLineSeries>
#include <QtCharts/QPieSeries>
#include <QtCharts/QChart>
#include <QComboBox>
#include <QPushButton>
#include "./Common/config.h"
#include "./Common/usermanagement.h"
#include "../mainwidget.h"

using namespace QtCharts;

namespace Ui {
class Widget_doctor;
}

class DoctorManagement;
class PatientManagement;
class AppointmentManagement;
class AdviceManagement;
class PrescriptionManagement;
class MedicalRecordManagement;
class MainWidget;

class Widget_doctor : public QWidget
{
    Q_OBJECT

public:
    explicit Widget_doctor(QWidget *parent = nullptr, QString userId = "", DoctorManagement* dm = nullptr,
                           PatientManagement* pm = nullptr, AppointmentManagement* am = nullptr,
                           AdviceManagement* adm = nullptr, PrescriptionManagement* pscm = nullptr,
                           MedicalRecordManagement* mrm = nullptr);
    void initUserInfo();
    ~Widget_doctor();

    void showChatClient();
    void on_generate_graph_btn_clicked();
signals:
    void back();
    void requestChatClient();
protected:
    virtual void paintEvent(QPaintEvent *event);
    void incomingConnection(qintptr socketDescriptor);

private slots:
    void on_pushButton_back_clicked();

    void on_edit_btn_clicked();

    void on_appointment_btn_clicked();

    void on_diag_btn_clicked();

    void on_chat_btn_clicked();

    void on_graph_btn_clicked();

    void on_submit_instruction_btn_clicked();

    void on_medical_record_btn_clicked();

    void on_submit_medical_record_btn_clicked();

    void on_submit_prescription_btn_clicked();

    void on_prescription_btn_clicked();

    void on_exit_btn_clicked();

    void on_update_btn_clicked();

private:
    Ui::Widget_doctor *ui;
    std::shared_ptr<DoctorManagement> d_m;
    std::shared_ptr<PatientManagement> p_m;
    std::shared_ptr<AppointmentManagement> a_m;
    std::shared_ptr<AdviceManagement> ad_m;
    std::shared_ptr<PrescriptionManagement> psc_m;
    std::shared_ptr<MedicalRecordManagement> mr_m;

    QString user_id;
    // --------------------------------------------
    QComboBox *graph_type_combo_box;
    QPushButton *generate_graph_btn;
    QLineEdit *input_data_line_edit;
    QChartView *chartView;
};

#endif // WIDGET_DOCTOR_H
